<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Fit Layout</title>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
    <script src="../../../scripts/jquery.min.js"></script>
    <script src="../../../scripts/miniui/miniui.js"></script>
    <link href="../../../scripts/miniui/themes/default/miniui.css" rel="stylesheet">
    <link href="../../../scripts/miniui/themes/icons.css" rel="stylesheet">
    <link href="../../../scripts/miniui/themes/pure/skin.css" rel="stylesheet">
    <script src="../../../scripts/core.js"></script>

</head>
<body>
<style type="text/css">
    html, body {
        margin: 0;
        padding: 0;
        border: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
</style>
<mini-toolbar style="width:100%;border-bottom:0;padding:0px;">
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">

                <a class="mini-button" iconCls="icon-save" onclick="humanRecharge()" plain="true">补单</a>
                从<input class="mini-datepicker" id="start"/>到
                <input class="mini-datepicker" id="end"/>

                <input class="mini-combobox" emptyText="支付渠道" id="payType" showNullItem="true"
                       style="width:150px;"
                       textField="text"
                       url="../../../data/payType.js" valueField="id"/>
                <input class="mini-combobox" emptyText="充值类型" id="callbackType" showNullItem="true"
                       style="width:150px;"
                       textField="text"
                       url="../../../data/rechargeType.js"
                       valueField="id"/>
                <input class="mini-combobox" emptyText="支付状态" id="statusType" showNullItem="true"
                       style="width:150px;"
                       textField="text"
                       url="../../../data/statusType.js"
                       valueField="id"/>
            </td>
            <td style="white-space:nowrap;">
                <input class="mini-textbox" emptyText="关键字" id="key" onenter="onKeyEnter" style="width:150px;"/>
                <a class="mini-button" onclick="search()">查询</a>
            </td>
        </tr>
    </table>
</mini-toolbar>
<!--撑满页面-->
<div class="mini-fit">

    <mini-datagrid _dataField="data111" allowCellEdit="true" allowCellSelect="true"
                   allowResize="true"
                   allowSortColumn="false" class="mini-datagrid"
                   id="datagrid1"
                   idField="id" multiSelect="false"
                   pageSize="30" showSortIcon="true"
                   style="width:100%;height:100%;"
                   url="/recharge/getAllOrder"
    >
        <columns>
            <column type="indexcolumn"></column>
            <column field="country" width="50">国籍

            </column>
            <column field="nick" width="100">昵称

            </column>

            <column dateFormat="yyyy-MM-dd HH:mm:ss" field="regTime" width="80">注册时间
            </column>
            <column dateFormat="yyyy-MM-dd HH:mm:ss" field="lastOfflineTime" width="150">最后离线时间
            </column>

            <column field="userId" headerAlign="center" name="userId" width="100">
                用户id
            </column>

            <column dateFormat="yyyy-MM-dd HH:mm:ss" field="createTime" width="80">订单时间
            </column>
            <column field="amountStr" width="50">订单金额

            </column>


            <column field="statusStr" width="70">支付状态

            </column>
            <column field="callbackTypeStr" width="40">充值类型

            </column>

            <column field="remark" width="100">备注
            </column>
            <column field="failDes" width="150">ton支付失败原因

            </column>
            <column field="payTypeStr" width="40">支付渠道

            </column>
            <column field="consumeStr" width="50">单价

            </column>
            <column field="walletAddress" width="100">钱包地址
            </column>
            <column field="id" width="100">订单id

            </column>
        </columns>
    </mini-datagrid>

</div>

<script type="text/javascript">

    var auth = GetParams()
    mini.parse();


    var grid = mini.get("datagrid1");
    grid.setAjaxOptions({
        headers: {"userId": auth.userId, "token": auth.token}
    });
    grid.on("drawcell", function (e) {
        var record = e.record,
            column = e.column,
            field = e.field,
            value = e.value;


    });
    grid.load();

    function humanRecharge() {
        if (grid.getSelecteds().length == 0) return;
        var row = grid.getSelecteds()[0];

        $.ajax({
            url: "/recharge/humanRecharge",
            data: mini.encode(row),
            type: "post",
            headers: {"userId": auth.userId, "token": auth.token},
            contentType: 'application/json',
            success: function (text) {
                grid.reload();
                var resp = mini.decode(text);
                if (resp.code == 200) {
                    mini.alert("补单成功")
                }
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert(jqXHR.responseText);
            }
        });
    }

    function search() {
        var start = mini.get("start").getValue();
        var end = mini.get("end").getValue();
        var key = mini.get("key").getValue();
        var payType = mini.get("payType");
        var statusType = mini.get("statusType");
        var callbackType = mini.get("callbackType");
        grid.load({
            userId: key,
            payType: payType.getValue(),
            statusType: statusType.getValue(),
            callbackType: callbackType.getValue(),
            startTime: start == null ? null : mini.formatDate(start, "yyyy-MM-dd"),
            endTime: end == null ? null : mini.formatDate(end, "yyyy-MM-dd")
        });
    }


</script>

</body>
</html>